<template>
  <a-modal
    title="验证信息"
    width="90%"
    :visible="visible"
    :confirmLoading="confirmLoading"
    class="j-table-force-nowrap"
    @cancel="handleCancel"
    :maskClosable="false"
    :footer="null"
  >
    <div class="table-operator mg-tp-sm" >
      <a-button @click="exportValidate" type="primary" icon="download">导出</a-button>
    </div>

    <a-table :columns="columns"
             :rowKey="(r,p)=>{return p}"
             :scroll="{ x: 620,y: 500 }"
             :data-source="datasource"
             bordered >
    </a-table>
  </a-modal>
</template>

<script>
  import {downloadFile} from "@/api/manage";

  export default {
    name: "ExcelValidateModal",
    data() {
      return {
        visible: false,
        confirmLoading: false,
        redisKey: '',
        columns: [
          {
            title: '错误行',
            width: 120,
            align: 'center',
            dataIndex: 'rowIndex',
            ellipsis: true,
          },
          {
            title: '校验信息',
            align: 'center',
            dataIndex: 'message',
            width: 500,
            ellipsis: true,
          },
        ],
        datasource: [],
        url:{
             exportXlsx: '/component/component/exportValiateMsg'
        }
      }
    },
    methods: {
      show(result) {
        this.datasource = result.validateMessages;
        this.redisKey = result.redisKey;
        this.visible = true;
      },
      handleCancel() {
        this.visible = false;
      },
      exportValidate(){
        downloadFile(this.url.exportXlsx,"校验信息.xlsx",{validateId:this.redisKey});
      }
    }
  }
</script>

<style scoped>

</style>